package com.muyu.product.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;
import io.swagger.annotations.*;
import com.muyu.common.core.annotation.Excel;
import com.muyu.product.domain.req.BrandInfoQueryReq;
import com.muyu.product.domain.req.BrandInfoSaveReq;
import com.muyu.product.domain.req.BrandInfoEditReq;
import com.muyu.common.core.web.domain.BaseEntity;

/**
 * 品牌信息对象 brand_info
 *
 * @author DongZeLiang
 * @date 2024-02-27
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("brand_info")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "BrandInfo", description = "品牌信息")
public class BrandInfo extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(name = "主键", value = "主键")
    private Long id;

    /**
     * 品牌名称
     */
    @Excel(name = "品牌名称")
    @ApiModelProperty(name = "品牌名称", value = "品牌名称", required = true)
    private String nam;

    /**
     * LOGO
     */
    @Excel(name = "LOGO")
    @ApiModelProperty(name = "LOGO", value = "LOGO", required = true)
    private String logo;

    /**
     * 是否启用
     */
    @Excel(name = "是否启用")
    @ApiModelProperty(name = "是否启用", value = "是否启用", required = true)
    private String start;

    /**
     * 介绍
     */
    @Excel(name = "介绍")
    @ApiModelProperty(name = "介绍", value = "介绍")
    private String introduction;

    /**
     * 查询构造器
     */
    public static BrandInfo queryBuild(BrandInfoQueryReq brandInfoQueryReq) {
        return BrandInfo.builder()
                .nam(brandInfoQueryReq.getNam())
                .logo(brandInfoQueryReq.getLogo())
                .start(brandInfoQueryReq.getStart())
                .introduction(brandInfoQueryReq.getIntroduction())
                .build();
    }

    /**
     * 添加构造器
     */
    public static BrandInfo saveBuild(BrandInfoSaveReq brandInfoSaveReq) {
        return BrandInfo.builder()
                .nam(brandInfoSaveReq.getNam())
                .logo(brandInfoSaveReq.getLogo())
                .start(brandInfoSaveReq.getStart())
                .introduction(brandInfoSaveReq.getIntroduction())
                .remark(brandInfoSaveReq.getRemark())
                .build();
    }

    /**
     * 修改构造器
     */
    public static BrandInfo editBuild(Long id, BrandInfoEditReq brandInfoEditReq) {
        return BrandInfo.builder()
                .id(id)
                .nam(brandInfoEditReq.getNam())
                .logo(brandInfoEditReq.getLogo())
                .start(brandInfoEditReq.getStart())
                .introduction(brandInfoEditReq.getIntroduction())
                .createBy(brandInfoEditReq.getCreateBy())
                .createTime(brandInfoEditReq.getCreateTime())
                .updateBy(brandInfoEditReq.getUpdateBy())
                .createTime(brandInfoEditReq.getCreateTime())
                .remark(brandInfoEditReq.getRemark())
                .build();
    }

}
